package com.ynny.demo02;

public class Student extends Person {
    private int no;
    private double scoreEn;
    private double scoreMath;
    private double scoreCh;

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }
    public double aver(){
        return (getScoreCh() + getScoreMath() + getScoreEn()) / 3;
    }
    public  double min() {
        if (scoreCh < scoreEn && scoreEn < scoreMath) {
            return (scoreCh);
        } else if (scoreEn < scoreMath && scoreMath < scoreCh) {
            return (scoreEn);
        } else {
            return (scoreMath);
        }
    }

    @Override
    public String toString() {
        return "Student{" +
                "no=" + no +
                ", scoreEn=" + scoreEn +
                ", scoreMath=" + scoreMath +
                ", scoreCh=" + scoreCh +
                '}';
    }
}
